package com.wildfire.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wildfire.dao.AuthDao;
import com.wildfire.dto.AuthDto;
import com.wildfire.service.BasicService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@Service
@Slf4j
@RequiredArgsConstructor
public class BasicServiceImpl implements BasicService{
    @Autowired
    private AuthDao authDao;
    @Override
    public Map<String, List<String>> getAppRouter() {
        Map<String, List<String>> routerMap = new HashMap<String, List<String>>();
        List<AuthDto> authDtos = authDao.getAuthList();
        for(AuthDto authDto:authDtos){
            List<String> accessList = authDao.getAccessByAuth(authDto.getId());
            routerMap.put(authDto.getUrl(), accessList);
        }
        return routerMap;
    }
    
}
